package com.andy.blog.admin.controller;

import com.andy.blog.admin.dto.BlogInfoDTO;
import com.andy.blog.admin.service.BlogInfoBusService;
import com.andy.blog.common.reponse.GeneralResponseResult;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * Created by andy on 2023/8/5 10:25
 */
@RestController
@RequestMapping("/portal/blogInfo")
public class BlogInfoController {

    @Resource
    private BlogInfoBusService blogInfoBusService;

    /**
     * 独立访客统计UV
     */
    @PostMapping("/report")
    public GeneralResponseResult<Void> report() {
        blogInfoBusService.report();
        return GeneralResponseResult.success();
    }


    /**
     * 网站初始化配置
     */
    @GetMapping("/")
    public GeneralResponseResult<BlogInfoDTO> getBlogInfo() {
        return GeneralResponseResult.success(blogInfoBusService.getBlogInfo());
    }

    /**
     * 获取打字机文字
     */
    @GetMapping("/getEveryHitokoto")
    public GeneralResponseResult<String> getEveryHitokoto() {
        return GeneralResponseResult.success(blogInfoBusService.getEveryHitokoto());
    }
}
